package org.onion.pattern.kit.administdivision;

import java.util.Optional;

/**
 * https://github.com/modood/Administrative-divisions-of-China/blob/master/dist/areas.json
 */
public final class ChinaAdministrativeDivisions {

    public static Optional<String> findNameByCode(String code) {
        String name = Provinces.findNameByCode(code).orElse(null);
        if (name != null) {
            return Optional.of(name);
        }
        name = Cities.findNameByCode(code).orElse(null);
        if (name != null) {
            return Optional.of(name);
        }

        return Areas.findNameByCode(code);
    }


}
